#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef struct {
    double x;
    double y;
} Point;

typedef struct {
    char name[127];
    unsigned age;
    unsigned sex;
    Point address;
} Student;


char sexs[][7] = {"remale", "male"};

void print_student(Student *stu) {
    puts("student information:");
    puts("-----------------");

    printf("name: %s\n", (*stu).name);
    printf("age: %u\n", (*stu).age);
    printf("sex: %s\n", sexs[stu->sex]);
    printf("addr: x:%f, y:%f\n", stu->address.x, stu->address.y);

}


void main(void){

    const int xx = 100 ;
    const int *ba = &xx;

    printf("stoi:%d\n", atoi("a12abc"));
    return ;

    char a[] = {'1', 'a', 0, 'b', 'c'};

    printf("string: %s, length:%d\n", a, (unsigned)strlen(a));

    puts("\n\nstruct:\n");

    Student xiaoming = {"xiaoming", 18, 0, {22.4, 55.678}};

    print_student(&xiaoming);
    putchar('\n');

    Student xiaojing = xiaoming;
    strcpy(xiaojing.name, "xiaojing");

    Student *xiaoj = &xiaojing;

    xiaoj->sex = 1;
    (*xiaoj).age = 25;

    xiaoj->address.x = 100.97;

    xiaoj->address.y = 200.19;

    print_student(&xiaojing);
}

